﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Data;
using System.Data.SqlClient;
using DAL;

namespace DLL
{
    public class TestQuestionDAL
    {
        

        /// <summary>
        /// 部署后测试，将出现的问题添加进数据库中
        /// </summary>
        /// <param name="question">问题</param>
        /// <returns>flag</returns>
        public int InsertQuestion(QuestionEntity question)
        {
            SQLHelper sqlhelper = new SQLHelper();
            string sql = "insert into TestQuestionEntity values(@question,@studentId)";
            SqlParameter[] paras =
            {
                new SqlParameter ("@studentId",question.Studentid),
                new SqlParameter("@question",question.Question)
            };
            int flag = sqlhelper.ExecuteNonQuery(sql, paras, CommandType.Text);
            return flag;
        }

        /// <summary>
        /// 部署后测试，将出现的问题呈现在DataGridView中
        /// </summary>
        /// <returns></returns>
        //public List<QuestionEntity> SelectQuestion()
        //{
        //    SQLHelper sqlhelper = new SQLHelper();
        //    string sql = "select * from TestQuestionEntity";
        //    DataTable table = sqlhelper.ExecuteQuery(sql, CommandType.Text);
        //    TBToList<QuestionEntity> tb = new TBToList<QuestionEntity>();
        //    List<QuestionEntity> list = tb.ToList(table);
        //    return list;
        //}


    }
}
